package com.xxxx.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestRedisSentinel {
    @Autowired
    private StringRedisTemplate redisTemplate;

    @GetMapping("/test")
    public String test(){
        ValueOperations ops = redisTemplate.opsForValue();

        ops.set("name","zhangsan");
        String name = (String)ops.get("name");
        System.out.println(name);
        return name;
    }
}
